#ifndef __AUDIOPLAYINGVOICE_INCLUDED
#define __AUDIOPLAYINGVOICE_INCLUDED


namespace Audio
{
	class PlayingCompeletCallback
	{
	public:
		virtual void OnPlayingComplete(UINT32 id) = 0;
	};

	class AudioPlayingVoice : public ErroableObject
	{
	public:

		AudioPlayingVoice(AudioVoice* voice, UINT32 id);
		~AudioPlayingVoice();
		
		void SetInfo(IVoice* voice);
		void Start();
		void Start(PlayingCompeletCallback* callback);
		void Stop();
		void Resume();
		BOOL IsPlaying();
		
		void LoadData();
		void SetVolume(FLOAT vol);
		FLOAT GetVolume();

		AudioVoice* GetVoice(){ return voice; }
		BOOL  IsAllDataSubmited() const;

		void  PlayingCompleted();
		UINT32 GetSamplePlayed() const;
		UINT32 GetId() const { return id;}

	private:
		IVoice*				lowLevelVoice;
		float				runningTime;
		AudioVoice*			voice;
		AudioDataBuffer*	buffer;	
		AudioStream*		stream;
		BOOL				allDataSubmitted;
		BOOL				isPlaying;
		PlayingCompeletCallback* completeCallback;
		UINT32				id;
	};
}



#endif